package com.hhkj.study.admin.course.model.res;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hhkj.study.admin.course.entity.CourseResourceInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * @Author luowu
 * @Date 2024/10/10 涵 11:54:54
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class UserCourseRes extends CourseRes {

    /**
     * 商品有效期开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date validStartTime;

    /**
     * 商品有效期结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date validEndTime;

    /**
     * 完成课程数
     */
    private Integer finishLessonCount;

    /**
     * 课程总数
     */
    private Integer lessonCount;

    /**
     * 子订单id
     */
    private Long orderItemId;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 商品sku名称
     */
    private String goodsSkuName;

    @JsonIgnore
    public String getOrderItemConcatCourseId(){
        return this.getOrderItemId() + "-" + this.getId();
    }

    @JsonIgnore
    @Override
    public CourseResourceInfo getAssocResourceStat() {
        return super.getAssocResourceStat();
    }
}
